* {
    margin: 0;
    padding: 0;
}

body {
    overflow: hidden;
}

.navbar {
    position: relative;
    width: 100vm;
}

.navbar input {
    display: none;
}

.navbar label {
    position: absolute;
    top: 0;
    left: 70px;
    width: 100%;
    height: 43px;
    font-size: 30px;
    background-color: #ededed;
    color: #5a738e;
    padding-left: 20px;
    border: 1px solid #d9dee4;
    cursor: pointer;
    /* 设置过渡 */
    transition: all .5s;
}

.navbar ul {
    overflow: hidden;
    list-style: none;
    width: 70px;
    height: 100vh;
    background-color: #2a3f54;
    transition: all .5s;
}

.navbar ul li {
    height: 70px;
    margin-bottom: 10px;
}

.navbar ul li:first-child {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 10px;
}

.navbar ul li:first-child img {
    width: 50px;
    border-radius: 50%;
}

.navbar ul li:first-child span {
    color: #fff;
    white-space: nowrap;
    display: none;
    padding-left: 10px;
}

.navbar ul li a {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
    color: #d1d1d1;
    text-decoration: none;
}

.navbar ul li a i {
    font-size: 25px;
    margin-bottom: 10px;
}

.navbar ul li a span {
    font-size: 10px;
    /* 给这个文字也设置禁止换行，不然切换的一瞬间会垂直排列 */
    white-space: nowrap;
}

.navbar ul li a:hover {
    color: #fff;
    background-color: #35495d;
}

/*
    :checked 选择器判断复选框是否被选中
    + 是相邻兄弟选择器，找到了 input 的下一个兄弟 label
*/
.navbar input:checked + label {
    left: 200px;
}

/*
    ~ 也是兄弟选择器，但是可以找到任何一个兄弟
*/
.navbar input:checked ~ ul {
    width: 200px;
}

.navbar input:checked ~ ul li:first-child {
    justify-content: flex-start;
}

.navbar input:checked ~ ul li:first-child span {
    display: block;
}

.navbar input:checked ~ul li a {
    /* 改变了主轴的方向为默认值  水平排列 */
    flex-direction: row;
    justify-content: flex-start;
}

.navbar input:checked ~ ul li a i {
    font-size: 18px;
    margin: 0 15px;
}

.navbar input:checked ~ ul li a span {
    font-size: 13px;
}
